<% title _("User Groups") %>

<% title_actions new_link(_("Create User Group")) %>

<table class="<%= table_css_classes 'table-fixed' %>">
  <thead>
    <tr>
      <th class="col-md-4"><%= sort :name, :as => s_("Usergroup|Name") %></th>
      <th class="col-md-4"><%= _("Users") %></th>
      <th class="col-md-3"><%= _("User Groups") %></th>
      <th><%= _('Actions') %></th>
    </tr>
  </thead>
  <tbody>
    <% @usergroups.each do |usergroup| %>
      <tr>
        <td class="ellipsis"><%= link_to_if_authorized trunc_with_tooltip(usergroup.name), hash_for_edit_usergroup_path(:id => usergroup.id).merge(:auth_object => usergroup, :authorizer => authorizer) %></td>
        <td class="ellipsis"><%= usergroup.users.except_hidden.map(&:login).to_sentence %></td>
        <td class="ellipsis"><%= usergroup.usergroups.map(&:name).to_sentence %></td>
        <td>
          <%= action_buttons(display_delete_if_authorized(
            hash_for_usergroup_path(:id => usergroup).
            merge(:auth_object => usergroup, :authorizer => authorizer),
            :data => { :confirm => (_("Delete %s?") % usergroup.name) } )) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @usergroups %>
